<?php

namespace addons\scrm;

use app\common\library\Menu;
use think\Addons;

/**
 * 插件
 */
class Scrm extends Addons
{

    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        $menu = [
            [
                'name'    => 'scrm',
                'title'   => '客户管理',
                'icon'    => 'fa fa-address-book',
                'sublist' => [
                    [
                        'name'    => 'scrm/client',
                        'title'   => '客户信息',
                        'icon'    => 'fa fa-address-card',
                        'sublist' => [
                            ['name' => 'scrm/client/index', 'title' => '查看'],
                            ['name' => 'scrm/client/detail', 'title' => '详情'],
                            ['name' => 'scrm/client/add', 'title' => '添加'],
                            ['name' => 'scrm/client/edit', 'title' => '修改'],
                            ['name' => 'scrm/client/del', 'title' => '删除'],
                            ['name' => 'scrm/client/multi', 'title' => '批量更新'],
                        ]
                    ],
                    [
                        'name'    => 'scrm/clist',
                        'title'   => '客户列表',
                        'icon'    => 'fa fa-bars',
                        'sublist' => [
                            ['name' => 'scrm/clist/index', 'title' => '查看']
                        ]
                    ],
                    [
                        'name'    => 'scrm/remind',
                        'title'   => '实时提醒',
                        'icon'    => 'fa fa-clock-o',
                        'sublist' => [
                            ['name' => 'scrm/remind/index', 'title' => '查看'],
                            ['name' => 'scrm/remind/detail', 'title' => '详情'],
                            ['name' => 'scrm/visit/index', 'title' => '回访列表'],
                            ['name' => 'scrm/visit/detail', 'title' => '回访详情'],
                            ['name' => 'scrm/visit/add', 'title' => '添加'],
                            ['name' => 'scrm/visit/del', 'title' => '删除']
                        ]
                    ],
                    [
                        'name'    => 'scrm/recycle',
                        'title'   => '客户公海',
                        'icon'    => 'fa fa-recycle',
                        'sublist' => [
                            ['name' => 'scrm/recycle/index', 'title' => '查看']
                        ]
                    ]
                ]
            ]
        ];
        Menu::create($menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        Menu::delete('scrm');
        return true;
    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        Menu::enable('scrm');
        return true;
    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        Menu::disable('scrm');
        return true;
    }

}
